<template>
  <!-- TODO: router-link -->
  <router-link
    :to="{name: '', query: {}}"
    tag="div"
    class="completed-module"
  >
    <van-circle
      v-model="currentRate"
      size="1.66667rem"
      layer-color="#A4A9B2"
      :rate="item.rate"
    >
      <div class="module-rate">
        <div
          class="rate-number"
          :class="{'rate-number-green': item.rate > 0}"
        >
          {{ item.rate }}%
        </div>
        <div class="rate-prompt">
          {{ item.rate > 0 ? '正确率' : '未完成' }}
        </div>
      </div>
    </van-circle>
    <div class="module-info">
      <div class="info-prompt">
        {{ item.examStatus === 0 ? '看什么看！赶紧看书刷题去啦～' : '小伙伴们都在刷题，你还不赶紧来～' }}
      </div>
      <div class="info-bottom">
        <div class="info-time">
          {{ item.time }}
        </div>
        <div class="have-done-people">
          {{ item.haveDonePeople }}人做过
        </div>
        <div class="info-button">
          {{ item.examStatus === 0 ? '马上补做' : '马上复习' }}
        </div>
      </div>
    </div>
  </router-link>
</template>
<script lang="ts">
import Vue from 'vue'
import { Circle } from 'vant'
export default Vue.extend({
  components: {
    'van-circle': Circle,
  },
  props: {
    item: {
      type: Object,
      default: () => ({}),
    },
  },
  data () {
    return {
      currentRate: 0,
    }
  },
})
</script>
<style lang="scss" scoped>
.completed-module {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 165px;
}
.module-rate {
  position: relative;
  width: 125px;
  height: 125px;
  // border-radius: 50%;
  margin-right: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  // @include px1border(all, #A4A9B2);
}
.rate-number {
  color: #333;
  font-size: 36px;
}
.rate-number-green {
  color: $primary-web;
}
.rate-prompt {
  color: #4B515E;
  font-size: 24px;
}
.module-info {
  width: calc(100% - 138px);
  height: 165px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  @include px1border(bottom, #E9E9E9);
}
.info-prompt {
  color: #333;
  font-size: 30px;
}
.info-bottom {
  position: relative;
  display: flex;
  margin-top: 24px;
}
.info-time {
  color: #A4A9B2;
  font-size: 24px;
  margin-right: 20px;
}
.have-done-people {
  color: #A4A9B2;
  font-size: 22px;
}
.info-button {
  position: absolute;
  right: 0;
  color: $primary-web;
  font-size: 24px;
}
</style>
